package com.wch.SpringBootTestDemo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.wch.SpringBootTestDemo.dao.UserDao;
import com.wch.SpringBootTestDemo.entity.User;
import com.wch.SpringBootTestDemo.service.UserService;

@Service
public class UserServiceImpl implements UserService{

	@Autowired
	private UserDao userDao;
	
	@Cacheable(value="userCache",key="#userName",condition="#userName.length()>0")  //add by WanChengHe 20190125 增加使用cache
	@Override
	public User getUserInfoByName(String userName){
		// TODO Auto-generated method stub
		User user = userDao.getUserInfoByName(userName);
		
		return user;
	}

}
